from typing import Optional

from sqlmodel import SQLModel, Field
import sqlmodel


class IBaseStationCreate(SQLModel):
    # 基站名称
    name: Optional[str]
    # 点位经度
    longitude: Optional[float]
    # 点位纬度
    latitude: Optional[float]
    # 基站地址
    address: Optional[str]
    # 是否天面 是否天面：0-禁用 1-启用（default
    is_rooftop: Optional[bool]


class ILTEFreqRecordCreate(SQLModel):
    point_number: str = Field(max_length=10, description="点位编号(如1#、2#等)")
    point_description: str = Field(
        max_length=100, description="点位描述(如7F医学楼天面北侧等)"
    )
    line_max: float = Field(description="线最大值")
    line_min: float = Field(description="线最小值")
    result_1: float = Field(description="监测结果1(V/m)")
    result_2: float = Field(description="监测结果2(V/m)")
    result_3: float = Field(description="监测结果3(V/m)")
    result_4: float = Field(description="监测结果4(V/m)")
    result_5: float = Field(description="监测结果5(V/m)")
    longitude: float = Field(description="经度(°)")
    latitude: float = Field(description="纬度(°)")
    image_path: Optional[str] = Field(
        default=None, max_length=255, description="图片文件路径及名称"
    )
    remarks: Optional[str] = Field(default=None, max_length=500, description="备注信息")
    # 关联的基站ID
    base_station_id: int = Field(foreign_key="base_stations.id", description="基站ID")
    recorder: Optional[str]
